﻿#region Using Statements
using System;
using System.Diagnostics;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Input;
#endregion

namespace GameStateManagement
{
    class Shield
    {
        Vector2 position;
        Vector2 angle; 
        Vector2 normal; 
        float rotation;
        Rectangle shieldRect;
        Animation shieldAnimation;
        //bool Active;

        public Shield(Vector2 pos, float rot, Texture2D shield)
        {

            
            //Active = true; 
            position = pos;
            rotation = rot;
            angle = new Vector2((float)Math.Sin(rot), -(float)Math.Cos(rot)); ;
            normal.X = -angle.Y;
            normal.Y = angle.X;
            shieldRect = new Rectangle((int)position.X, (int)position.Y, 3, 3);
            
            shieldAnimation = new Animation();
            shieldAnimation.Initialize(shield, position, 3, 3, 4, 150, Color.White, 1f, true);
        }

       public Vector2 getPos() { return position; }
       public float getRot() { return rotation; }
       public Rectangle getRect() { return shieldRect; }
       public Vector2 getNorm() { return normal; }

        public void Draw(SpriteBatch spritebatch)
        {
            shieldAnimation.Draw(spritebatch, rotation, position);
         }

        public void Update(GameTime gameTime)
        {
            this.shieldAnimation.Update(gameTime); 
        }
    }
}
